<!doctype html>
<html class="no-js" lang="en">
<head>
<meta name="layout" content="common">
<style>
select[name$="_month"]{
	width:auto;
}
select[name$="_year"]{
	width:auto;
}
select[name$="_day"]{
	width:auto;
}
</style>
<title>Edit Profile</title>
</head>
<body id="body">
	<h2>Edit Profile</h2>
	<hr />
	<g:if test="${flash.message}">
		<div class="alert alert-success">
			<img src="${resource(dir:'images', file:'icon_successful.png') }" />&nbsp;&nbsp;${flash.message}
		</div>
	</g:if>
	<!--
	<g:hasErrors bean="${userInstance}">
			<ul class="errors" role="alert">
				<g:eachError bean="${userInstance}" var="error">
				<li <g:if test="${error in org.springframework.validation.FieldError}">data-field-id="${error.field}"</g:if>><g:message error="${error}"/></li>
				</g:eachError>
			</ul>
	</g:hasErrors>
	 -->
	<div class="row>">
		<g:form method="POST" action="show">
			<table class="table table-striped">
			  <thead>
        		<tr>
            	  <th>username: ${userInstance.username}</th>
        		</tr>
    	  	  </thead>
    		  <tbody>
				<tr>
					<td width="30%">Name&nbsp;<font color="red">*</font></td>
					<td>
						<g:textField name="name"  maxlength="18" value="${fieldValue(bean:userInstance,field:'name')}"/>
						<span class="errorMsg"><br/><g:fieldError bean="${userInstance}" field="name" /></span>
					</td>
				</tr>
				<tr>
					<td width="30%">Date of Birth&nbsp;<font color="red">*</font></td>
					<td>
          				<g:datePicker name="birthDate" value="${userInstance.birthDate}" precision="day" years="${1930..1990}"/>
						<span class="errorMsg"><br/><g:fieldError bean="${userInstance}" field="birthDate" /></span>
					</td>
				</tr>
				<tr>
					<td width="30%">Gender&nbsp;<font color="red">*</font></td>
					<td>
						<g:select name="gender" from="${['M', 'F']}" value="${userInstance.gender}"/>
						<span class="errorMsg"><br/><g:fieldError bean="${userInstance}" field="gender" /></span>
					</td>
				</tr>
				<tr>
					<td width="30%">NRIC&nbsp;<font color="red">*</font></td>
					<td>
						<g:textField name="nric" maxlength="18"  value="${fieldValue(bean:userInstance,field:'nric')}"/>
						<span class="errorMsg"><br/><g:fieldError bean="${userInstance}" field="nric" /></span>
					</td>
				</tr>
				<tr>
					<td width="30%">Email&nbsp;<font color="red">*</font></td>
					<td>
						<g:textField name="email" maxlength="28"  value="${fieldValue(bean:userInstance,field:'email')}"/>
						<span class="errorMsg"><br/><g:fieldError bean="${userInstance}" field="email" /></span>
					</td>
				</tr>
				<tr>
					<td width="30%">Mobile&nbsp;<font color="red">*</font></td>
					<td>
						<g:textField name="mobile" maxlength="18"  value="${fieldValue(bean:userInstance,field:'mobile')}"/>
						<span class="errorMsg"><br/><g:fieldError bean="${userInstance}" field="mobile" /></span>
					</td>
				</tr>
					<td width="30%">Email Notification&nbsp;<font color="red">*</font></td>
					<td>
						<g:checkBox name="emailNotification" value="${userInstance?.emailNotification}"/>
						<span class="errorMsg"><br/><g:fieldError bean="${userInstance}" field="emailNotification" /></span>
					</td>
				</tr>
				<tr>
					<td width="30%">SMS Notification&nbsp;<font color="red">*</font></td>
					<td>
						<g:checkBox name="smsNotification"  value="${userInstance?.smsNotification}"/>
						<span class="errorMsg"><br/><g:fieldError bean="${userInstance}" field="smsNotification" /></span>
					</td>
				</tr>	
			  </tbody>
			</table>
			<fieldset class="buttons">
					<g:actionSubmit class="btn btn-primary" action="updateProfile" value="Submit" />
					<g:actionSubmit class="btn" action="show" value="Cancel" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');" />
			</fieldset>
		</g:form>
	</div>
</body>
</html>
